package com.chenyun.gateway.security;//package com.chenyun.gateway.security;
//
//
//
//import com.alibaba.fastjson2.JSON;
//import com.chenyun.gateway.util.ResponseUtil;
//import org.springframework.core.io.buffer.DataBuffer;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.http.server.reactive.ServerHttpResponse;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.web.server.ServerAuthenticationEntryPoint;
//import org.springframework.stereotype.Component;
//import org.springframework.web.server.ServerWebExchange;
//import reactor.core.publisher.Mono;
//
//import java.nio.charset.Charset;
//import java.util.HashMap;
//import java.util.Map;
//
//
///**
// *无效token/token过期 自定义响应
// * @author: Lonni
// * @date: 2022/6/4 0004 22:28
// */
//@Component
//public class CustomServerAuthenticationEntryPoint implements ServerAuthenticationEntryPoint {
//
//    @Override
//    public Mono<Void> commence(ServerWebExchange exchange, AuthenticationException e) {
//        Map<String, Object> map = new HashMap<String, Object>() {{
//            put("code", 3002);
//            put("message", "无效的凭据!");
//            put("success", false);
//            put("data", null);
//        }};
//        return ResponseUtil.wirteResponse(exchange, map);
//
//    }
//
//}
